home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
tsptp.zip
/
IMATH.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-04-09
|
2KB
|
70 lines
(******************************************************************************)
(* IMATH.MOD *)
(* Integer Math Benchmark. *)
(******************************************************************************)
PROGRAM Imath(Output);
(******************************************************************************)
(* TIMING *)
(******************************************************************************)
(*$IFNDEF TopSpeed *)
(*%F TRUE *** Compile for Turbo Pascal ***)
USES TPBench;
(*%E*)
(*$ELSE *** Compile for TopSpeed Pascal ***)
IMPORT TSBench *;
(*$ENDIF *)
(******************************************************************************)
VAR X, Y : BmInt;
PROCEDURE IntMath;
VAR I : BmInt;
BEGIN
X := 0;
Y := 9;
FOR I := 1 TO 30000 DO
X := X + (Y * Y - Y) DIV Y;
END;
BEGIN
WriteLn('IntMath Benchmark');
(******************************************************************************)
(* Compute the looping overhead. The Dummy procedure must have some side- *)
(* effect so that it is not optimised out of existence. *)
(******************************************************************************)
StartTimer; (* Start the clock. *)
REPEAT
Dummy;
UNTIL NullTimesUp;
(******************************************************************************)
(* Now run the benchmark. Note that the Dummy procedure is also called so *)
(* that we can eliminate its overhead from the looping overhead. *)
(******************************************************************************)
StartTimer; (* Start the clock. *)
REPEAT
Dummy;
IntMath
UNTIL BenchTimesUp;
(******************************************************************************)
ReportTimes;
WriteLn;
WriteLn('Result: X = ', X:0);
END.